import request from '@/axios'

function formatRequestUri(name) {
  return 'flow/audit/' + name
}

export function Begin(data) {
  return request.post({
    url: formatRequestUri('BeginAudit'),
    data
  })
}
export function Get(id) {
  return request.get({
    url: formatRequestUri('GetCurentNode'),
    params: {
      id
    }
  })
}

export function GetNextStep(id) {
  return request.get({
    url: formatRequestUri('GetNextStep'),
    params: {
      id
    }
  })
}

export function Submit(id, data) {
  return request.post({
    url: formatRequestUri('Submit'),
    data: {
      Id: id,
      Value: data
    }
  })
}

export function GetAuditLog(logId) {
  return request.get({
    url: formatRequestUri('GetAuditLog'),
    params: {
      logId
    }
  })
}

export function GetNodeState(logId, flowId) {
  return request.get({
    url: formatRequestUri('GetNodeState'),
    params: {
      logId,
      flowId
    }
  })
}

export function GetCopyLog(id) {
  return request.get({
    url: formatRequestUri('GetCopyLog'),
    params: {
      id
    }
  })
}
export function GetFiles(logId) {
  return request.get({
    url: formatRequestUri('GetFiles'),
    params: {
      logId
    }
  })
}
